package controllers;

import models.cms.CMSImage;
import models.cms.CMSPage;
import play.api.templates.Html;
import play.mvc.Controller;
import play.mvc.Result;

public class Frontend extends Controller {
	public static Result show(String pageName) {
		CMSPage page = CMSPage.find.byId(pageName);
		if (page == null)
			return notFound();
		return(ok(views.html.Admin.cms.render(new Html(page.body))));

	}

	public static Result image(String name) {
		CMSImage image = CMSImage.find.byId(name);
		return ok(image.data).as(image.contentType);
	}
}
